package com.nineclock.document.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nineclock.document.pojo.DocFile;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface DocFileMapper extends BaseMapper<DocFile> {

    /**
     * 根据当前传递的员工ID, 查询能够操作的协作者文件
     * @param companyUserId
     * @param parentFoldId
     * @return
     */
    @Select("select * from doc_file where id in (select file_id from doc_collaborations where collaboration_id = #{companyUserId})  and status = 1 and folder_id = #{parentFoldId}")
    public List<DocFile> queryFileByCollaboration(@Param("companyUserId") Long companyUserId,@Param("parentFoldId") Long parentFoldId);

}
